


add_requires("python 3.x")

target("ar8030")
    add_rules("swig.c", {moduletype = "python"})
    add_files("ar8030.i", {scriptdir = "python"})
    add_packages("python")
    add_deps("ar8030_client")
    add_includedirs("./")

    on_install(function (target)
        pypath = path.join(target:installdir() , "python")
        os.mkdir(pypath)

        os.cp(target:targetfile() , pypath)
        os.cp(path.join(os.scriptdir() , "test.py" ) , pypath)
        print(target:data( "swig.scriptfiles"))
        for _,genfile in pairs(target:data("swig.scriptfiles")) do 
            os.cp(genfile , pypath)
        end
    end)

target("ar8030_callback")
    add_rules("swig.cpp", {moduletype = "python"})
    add_files("callback.i", {scriptdir = "python"})
    add_packages("python")
    add_deps("ar8030_client")
    add_includedirs("./")

    on_install(function (target)
        pypath = path.join(target:installdir() , "python")
        os.mkdir(pypath)

        os.cp(target:targetfile() , pypath)
        print(target:data("swig.scriptfiles"))
        for _,genfile in pairs(target:data("swig.scriptfiles")) do 
            os.cp(genfile , pypath)
        end
    end)